<!doctype html>
<html lang="zh-CN">
<head>
    <include file="include/head" title="订单支付" />
</head>

<body>
	<div class="header-blank"></div>
    <div class="header">
		订单支付
	</div>
	
	<div class="orderpay-main">
		<form method="post" action="{:U('Index/pay?order_id='.$info['id'])}" name="form" id="form">
			<div class="orderpay-tips">订单提交成功，请尽快支付！</div>
			<div class="orderpay-info">
				<p>订单号：{$info.sn}</p>
				<p>商品总价：{$info.total}</p>
				<p>&nbsp;</p>
				<p>应付金额：{$info['total']-$info['wxpay']-$info['points']-$info['money']}</p>
			</div>
			<div class="orderpay-pay">
				<p>
					<input type="checkbox" name="points" value="1" /> {$_CFG.site.points_name}支付(可抵：￥{:sprintf('%.2f',$user['points']/$_CFG['site']['points_rate'])})
				</p>
				<p>
					<input type="checkbox" name="money" value="1" /> 余额支付(可用：￥{$user.money})
				</p>
				<p>
					<input type="checkbox" name="wxpay" value="1" checked readonly /> 微信安全支付
				</p>
				<p>
					提示:{$_CFG.site.points_rate}{$_CFG.site.points_name} 相当于1元RMB
				</p>
			</div>
			<div class="orderpay-btn">
				<a href="javascript:;" onclick="form_submit()">立即支付</a>
			</div>
			<script>
				var need = {$info['total']-$info['wxpay']-$info['points']-$info['money']};
				var points = {$user.points};
				var money = {$user.money};
				
				function form_submit(){
					// 没有勾选微信支付则判断余额是否足够
					if(!$("input[name=wxpay]").is(':checked')){
						var have = 0;
						if($("input[name=points]").is(':checked')){
							have += points;
						}
						if($("input[name=money]").is(':checked')){
							have += money;
						}
						if(have < need){
							alert('所选择的支付方式余额不够,请勾选微信支付');
							return false;
						}
					}					
					form.submit();
				}
			</script>
		</form>
	</div>
	
	<include file="include/bottom" />


</body>
</html>